package com.gupao.decorator.Test;

import com.gupao.decorator.battercakedemo.BaseBatterCake;
import com.gupao.decorator.battercakedemo.BatterCake;
import com.gupao.decorator.battercakedemo.EggBatterCakeDecorator;
import com.gupao.decorator.battercakedemo.SausageBatterCakeDecorator;

import java.io.*;

public class DecoratorTest {
    public static void main(String[] args) {
//        InputStream in = null;
//
//        FilterInputStream fis = new DataInputStream(in);


        //new 一个基础的煎饼
        BatterCake batterCake = new BaseBatterCake();
        //在基础的煎饼上加一个鸡蛋，相当于对原来的类加一层包装类
        batterCake = new EggBatterCakeDecorator(batterCake);
        //在加鸡蛋的煎饼上再加一个香肠，相当于对已经包装的类的基础上再加一层的包装，以此类推
        batterCake = new SausageBatterCakeDecorator(batterCake);

        System.out.println(batterCake.getMsg()+"价格是："+batterCake.getPrice());


    }
}
